package com.techyuan.algorithm.sorts;

/**
 * 冒泡排序
 * Created by tianjuntao on 2016/11/5.
 */
public class BubbleSort implements ISort {
    public int[] sort(int[] sortingArr) {
        for (int i = 0; i < sortingArr.length; i++) {
            for (int j = i + 1; j < sortingArr.length; j++) {
                if (sortingArr[j] < sortingArr[i]) {
                    Integer temp = sortingArr[i];
                    sortingArr[i] = sortingArr[j];
                    sortingArr[j] = temp;
                }
            }
        }
        return sortingArr;
    }
}
